<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="../c/aui.css" />
	<link rel="stylesheet" type="text/css" href="../c/renwu.css" />
	<style>
		body {
			background: #000
		}
		#appAd{
			padding:0 0.75rem;
			display: none;
		}
		#appAd img{
			border-radius: 0.75rem;
			width: 100%;
			height: auto;
		}
		.jinbi .border{
			padding: 0;
			border-radius: 0;
		}
		.jinbi .t{
			display: flex;
			justify-content: center;
			align-items: center;
			padding: 0;
			padding-top: 1rem;
		}
		.t div.s1{
			width: 50%;
		}
		.s1 span{
			display: block;
			text-align: center;
		}
		.s1 .c{
			border: 1px solid #fff;
			display: block;
			margin: 0.25rem auto;
			margin-top: 0.5rem;
			text-align: center;
			width: 3rem;
			border-radius: 2rem;
			opacity: 0.8;
			font-size: 0.65rem;
			padding: 0.15rem 0;
		}
		.t .p{
			font-size: 0.65rem;
			opacity: 0.8
		}
	</style>
</head>
<body>
	<div class="jinbi">
		<div class="border">
			<div class="t">
				<!-- <div class="s1">
					<span class="p" tapmode onclick="_url({url:'member_money',title:'我的金币'})">我的金币</span>
					<span class="a" id="wode" tapmode onclick="_url({url:'member_money',title:'我的金币'})">-</span>
					<span class="c" tapmode onclick="_url({url:'member_tixian',title:'立即提现'})">提现</span>
				</div> -->
				<div class="s1" tapmode onclick="_url({url:'member_tixian',title:'立即提现'})">
					<span class="p">今日金币</span>
					<span class="a" id="jinru">-</span>
					<span class="c">提现</span>
				</div>
				<div class="s1" tapmode onclick="_url({url:'member_money',title:'我的金币'})">
					<span class="p">昨日金币</span>
					<span class="a" id="zri">-</span>
					<span class="c">明细</span>
				</div>
				<div class="s1 qubi" tapmode onclick="_url({url:'zhibo_view_frm_chongzhi',title:'充值'})">
					<span class="p" >我的趣币</span>
					<span class="a">-</span>
					<span class="c">充值</span>
				</div>
			</div>
			<!-- <div class="b aui-card-list-footer">
				<div tapmode onclick="_url({url:'member_yaoqing',title:'邀请好友'})">
					<img src="../i/jinbi/yq.png" />
					<p>邀请好友</p>
				</div>
				<div tapmode onclick="_url({url:'member_money',title:'我的金币'})">
					<img src="../i/jinbi/qb.png" />
					<p>我的金币</p>
				</div>
				<div tapmode onclick="_url({url:'member_tixian',title:'立即提现'})">
					<img src="../i/jinbi/tx.png" />
					<p>立即提现</p>
				</div>
				<div tapmode onclick="_url({url:'member_tixian_list',title:'提现记录'})">
					<img src="../i/jinbi/jl.png" />
					<p>提现记录</p>
				</div>
			</div> -->
		</div>
	</div>
	<script id="sx-list" type="text/x-dot-template">
	{{? _getPrefs('_config').config.app == 1 }} <div id="loadingNo" class="meiyoushju" style="padding-top:70%;">没数据啦，多多互动吧 ~ </div> {{??}}
		<!-- 签到开始 -->
		<div class="sx-qiandao aui-content-padded">
			<div class="h2">
				<span>{{?it.qiandao.yse}}明天签到可得{{= it.qiandao.mingtian}}金币{{??}}今日签到可得{{= it.qiandao.jinbi}}金币{{?}}</span>
				<span>已签到{{= it.qiandao.tianshu}}天</span>
			</div>
			<div class="time aui-card-list-footer">
				{{ for(var i=0;i
				< it.config.qiandao.length; i++) { }} <div class="{{? i < it.qiandao.tianshu}}a{{?}}">
					<span>{{= it.config.qiandao[i] }}</span>
					<p>{{= i+1}}天</p>
			</div>
			{{ } }}
		</div>
		{{? !it.qiandao.yse}}
		<div class="sx-btn sx-btn-animation" tapmode onclick="qiandao_ajax(this)">签到领金币</div>
		{{?? !it.qiandao.jili}}
		<div class="sx-btn sx-btn-animation" style=" background:#FE2C55 " tapmode onclick="jili();">观看广告可获得双倍金币</div>
		{{??}}
		<div class="sx-btn sx-btn-s" tapmode onclick="return _msg('明天签到可得{{= it.qiandao.mingtian}}金币')">签到成功</div>
		{{?}}
		</div>
		<!-- 签到结束  return _msg('明天签到可得{{= it.qiandao.mingtian}}金币')  -->
		<div id="appAd"></div>
		{{ for(var i=0;i
		< it.renwu.length; i++) { }} <div class="sx-richang aui-card-list">
			<div class="aui-card-list-header">
				<div><i></i>{{= it.renwu[i].title}}</div>
			</div>
			<div class="aui-card-list-content">
				<ul class="aui-list aui-media-list">
					{{ for(var i_s=0;i_s
					< it.renwu[i].data.length; i_s++) { }} <li class="aui-list-item aui-list-item-middle">
						<div class="aui-media-list-item-inner" tapmode onclick="msg(this)">
							<div class="aui-list-item-inner aui-list-item-arrow">
								{{= it.renwu[i].data[i_s].title}} {{? !it.renwu[i].data[i_s].yse }}
								<span>奖励{{= it.renwu[i].data[i_s].jinbi}}金币</span> {{??}}
								<span class="a">已完成</span> {{?}}
							</div>
						</div>
						<div class="sx-msg">
							<span class="text">{{= it.renwu[i].data[i_s].msg}}</span> {{? !it.renwu[i].data[i_s].yse }}
							<span class="sx-btn" tapmode onclick="{{= it.renwu[i].data[i_s].url}}">开始做任务</span> {{??}}
							<span class="sx-btn sx-btn-s">已完成</span> {{?}}
						</div>
						</li>
						{{ } }}
				</ul>
			</div>
			</div>
			{{ } }} {{?}}
	</script>
	<div class="aui-content" id="sx-view">
		<div id="loadingdi_huifu" style=" margin-top:50% "><img src="../i/footer_progress.png" /></div>
	</div>
</body>
<script type="text/javascript" src="../j/api.js"></script>
<script type="text/javascript">
	var _root = 0,_config,_user;
	function urlsa() {
		var imglen = $("img").length;
		var picurlwa = picurl + "/jinbi";
		for (var i = 0; i < imglen; i++) {
			var tpl = $("img").eq(i).attr("src");
			tplaas = tpl.replace("../i/jinbi", picurlwa);
			$("img").eq(i).attr("src", tplaas);	
		
	}
	}
	apiready = function() {
		_config = _getPrefs('_config');
		_user = _getPrefs('_user');
		urlsa();
		$('.qubi .p').text('我的'+_config.zhibo.liwu_name)
		data();
if(adName){
	_init_ad();
	ad = api.require(adName);
}


		if (_getPrefs('_config').config.app == 1) {
			$('.jinbi').addClass('aui-hide');
		}
		// 应用从后台回到前台事件
		api.addEventListener({
			name: 'resume'
		}, function(ret, err) {
			if (_root) {
				data();
			}
		});
		// 离开屏幕
		api.addEventListener({
			name: 'viewdisappear'
		}, function(ret, err) {
			// ad.closeBannerAd(function(ret){
			// 		console.log("zyPangolinAd："+JSON.stringify(ret));
			// });
		});
		// 回到屏幕
		api.addEventListener({
			name: 'viewappear'
		}, function(ret, err) {
			if (_root) {
				if(_getPrefs('_config').ad.ad){
					if(_getPrefs('_config').ad.banner == 2  && ad_vip){
						chaping();
					}
				}
				data();
			}
			_root = 1;
		});


		chaping();
		//	$api.fixStatusBar($api.dom('.aui-content'));
		_shangla(function() {
			if(_getPrefs('_config').ad.ad){
				if(_getPrefs('_config').ad.banner == 2  && ad_vip){
					chaping();
				}
			}
			data();
		},1)
	}
	function info(){
		_userInfo();
		_ajax('member/jinbi',function(ret,err){
			if(ret){
				// $('#wode').text(_money(ret.jinbi));
				$('#jinru').text(_money(ret.today));
				$('#zri').text(_money(ret.yesterday));
				$('.qubi .a').text(_user.zhibo_zuan ? _user.zhibo_zuan : 0)
			}else{
				_alert(JSON.stringify(err));
			}
		})
	}
	function data() {
		_ajax('renwu/info', function(ret, err) {
			if (ret) {
				var evalData = doT.template($api.html($api.byId('sx-list')));
				$api.html($api.byId('sx-view'), evalData(ret));
				ad_ajax();
				api.parseTapmode();
			} else {
				_alert(JSON.stringify(err));
			}
			api.refreshHeaderLoadDone();
		})
		info();
	}
	// 签到
	function qiandao_ajax(_this) {
		_loading('请求数据...')
		_ajax('renwu/qiandao_ajax', function(ret, err) {
			if (ret) {
				if (ret.ret) {
					data();
					$(_this).text('签到成功');
					$(_this).addClass('sx-btn-s');
					// 弹窗
					var url = 'qiandao_msg';
					api.openFrame({
						name: url,
						url: _h_w + url + '.html',
						rect: {
							x: 0,
							y: 0,
							w: 'auto',
							h: 'auto',
						},
						pageParam: {
							jinbi: ret.jinbi
						},
						bgColor: 'rgba(0,0,0,0)',
					})
				}
			} else {
				_alert(JSON.stringify(err));
			}
			_loadingCloes();
		})
	}
	// 展开内容
	function msg(_this) {
		var _this = $(_this);
		if (_this.next().hasClass('aui-show')) {
			_this.removeClass('a');
			_this.next().removeClass('aui-show');
		} else {
			_this.addClass('a');
			_this.next().addClass('aui-show');
		}
	}
	// 广告
	function ad_ajax(){
		_ajax('ad/view/type/3',function(ret,err){
			if(ret.ret.data){
				var img = ret.ret.data.img;
				ad_ajax_url = ret.ret.data
				api.imageCache({
						url: _sx_qiniu+img,
						thumbnail: false
				}, function(ret, err) {
						if (ret) {
								if (ret.status) {
										img =  ret.url;
								}
								var _this = $('#appAd');
								var _imgsrc = $('#appAd img').attr('src');
								if(_imgsrc != img){
									_this.html('<img tapmode onclick="adurl(1)" src="'+img+'">');
									_this.show();
									api.parseTapmode();
									_ajax('ad/click/id/'+ad_ajax_url.id)
								}
								return;
						}
						$('#appAd').hide();
				});
			}else{
				$('#appAd').hide();
			}
		})
	}
	function adurl(){
		console.log(JSON.stringify(ad_ajax_url))
		_ajax('ad/click/id/'+ad_ajax_url.id+'/zhanshi/1')
		return eval('(' + ad_ajax_url.url + ')');
		return;
		if(ad_ajax_url.type_url){
			return eval('(' + ad_ajax_url.url + ')');;
		}else{
		 _url({url:_sx_gurl+'index.php/index/m/ad/id/'+ad_ajax_url.id},'curl');
		}
	}
</script>

</html>
